//
//  EDSAppDelegateTool.h
//  DriveSchoolCoach
//
//  Created by TangBin on 2019/7/5.
//  Copyright © 2019 TangBin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "TYZBaseNavigationController.h"
#import "TYZCustomTabBarController.h"
#import "ZHCustomUserInfoModel.h" // 用户信息
#import "WDUserDetailRequest.h" // 获取用户信息
#import "WDTaskAlarmRuleRequest.h" // 报警规则
#import "WDStationTaskParametersRequest.h" // 参数
#import "WDOnGoingListRequest.h" // 进行中工单列表
#import "WDSaveTaskAlarmRequest.h" // 任务单报警
#import "WDAppUserRoutesRequest.h" // 菜单权限


@class BDAdapter;

NS_ASSUME_NONNULL_BEGIN

@interface EDSAppDelegateTool : NSObject

/// 广告id
@property (nonatomic, copy) NSString *idfa;

@property (nonatomic, strong, nullable) TYZBaseNavigationController *loginNav; ///< 登录视图控制器

@property (nonatomic, strong, nullable) TYZCustomTabBarController *rootTabBar; ///< 根视图控制器


@property (nonatomic, strong, nullable) TYZBaseNavigationController *publishNav;

@property (nonatomic, strong) UIWindow *window;

@property (nonatomic, strong, nullable) ZHCustomUserInfoModel *userInfoModel; ///< 用户信息

@property (nonatomic, assign, readonly) EDS_NETWORK_STATUS networkStatus; ///< 网络状态


/// 客服电话
@property (nonatomic, strong) NSArray *custServicePhones;

@property (nonatomic, assign) NSInteger TabSelectedIndex;



/// 定位地址
@property (nonatomic, copy) NSString *address;

/// 定位城市
@property (nonatomic, copy) NSString *city;

/// 纬度
@property (nonatomic, assign) double latitude;

/// 经度
@property (nonatomic, assign) double longitude;

/// 0:抢单后抢单人APP定位一直在服务站内
@property (nonatomic, strong) WDTaskAlarmRuleModel *alarmRuleOneModel;

/// 1:抢单人APP定位距离服务站超出限定距离
@property (nonatomic, strong) WDTaskAlarmRuleModel *alarmRuleTwoModel;

/// 参数
@property (nonatomic, strong) WDStationTaskParametersModel *taskParametersModel;

/// 用户菜单权限
@property (nonatomic, strong) NSArray<WDAppUserRoutesModel *> *userRoutes;



+ (instancetype)sharedInstance;


- (void)updateRootVC;

/**
 将本地数据库放document目录下
 */
- (void)moveDbFileToDocument;


- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options;

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url;

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler;


/// 头条 头条投放（数据上报）
- (void)setupBDAutoTrack;

#pragma mark - 用户登录 退出登录 调用
/**
  保存用户信息 用户登录成功之后

 @param userInfo 用户信息
 */
- (void)saveUserInfo:(ZHCustomUserInfoModel *)userInfo;

/**
 获取用户信息

 @return return value description
 */
- (ZHCustomUserInfoModel *)getUserInfo;

- (NSString *)getUUID;

/**
  删除用户信息
 */
- (void)removeUserInfo;


/**
 用户退出登录成功
 */
- (void)loginOutSuccess;

/// 登录成功
- (void)loginSuccess;

/// 判断是否登录
/// @param vc vc description
- (BOOL)isLogin:(UIViewController *)vc;


/// 拉取微信客服
- (void)openWXCustomerService;

/// 用户账号注销成功后调用
- (void)userAccountDelete;

/// 用户菜单权限WDAppUserRoutesRequest
/// - Parameter completion: completion description
- (void)requestWithUserRoutes:(RequestCompletionBlock)completion;

/// 获取用户信息
/// - Parameter completion: completion description
- (void)requestWithUserInfo:(RequestCompletionBlock)completion;

/// 报警规则
- (void)requestWithAlarmRule;
//WDTaskAlarmRuleRequest

/// 获取参数 -- 预警参数 服务站信息
- (void)requestWithTaskParameters;
//WDStationTaskParametersRequest

/// 将报警信息发送到服务端
/// - Parameter model: model description
- (void)requestWithSaveAlarm:(WDSaveTaskAlarmReqModel *)model;
// WDSaveTaskAlarmRequest


/// 判断是否有权限
/// - Parameter code: code description
- (BOOL)hasPermission:(NSNumber *)code parentCode:(NSNumber * _Nullable)parentCode;

/// 是否有到站服务
- (BOOL)hasArrivalService;

/// 是否有外出救援
- (BOOL)hasOutRescue;

/// 是否有工单搜索
- (BOOL)hasWorkOrder;

/// 是否有我的
- (BOOL)hasMine;

/// 是否有扫码
- (BOOL)hasScanCode;

@end

NS_ASSUME_NONNULL_END
